package mediatheque.view;

import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import mediatheque.model.DocumentModel;


public abstract class DocumentDetailsView extends JPanel {

	private static final long serialVersionUID = 2162031771825852036L;

	protected DocumentModel model;

	protected JLabel lblIcone;
	
	protected JLabel lblIdentifiant;
	protected JLabel lblNom;
	protected JLabel lblDescription;
	protected JLabel lbldateAjout;

	protected JLabel lblIdentifiantValeur;
	protected JLabel lblNomValeur;
	protected JLabel lblDescriptionValeur;
	protected JLabel lbldateAjoutValeur;
	
	protected JScrollPane scroll;
	
	protected Font fontValeur;
	
	public DocumentDetailsView(DocumentModel model) {
		this.model = model;
		initialiserComposants();
	}
	
	protected void initialiserComposants(){		
		lblIcone = new JLabel();
		lblIcone.setHorizontalAlignment(JLabel.CENTER);
		
		lblIdentifiant = new JLabel("Identifiant : ");
		lblNom = new JLabel("Nom : ");
		lblDescription = new JLabel("Description : ");
		lbldateAjout = new JLabel("Date d'ajout : ");
		
		fontValeur = new Font("Verdana", 0, 12);
		
		lblIdentifiantValeur = new JLabel(model.getIdentifiant());
		lblIdentifiantValeur.setFont(fontValeur);
		lblNomValeur = new JLabel(model.getNom());
		lblNomValeur.setFont(fontValeur);
		lblDescriptionValeur = new JLabel("<html>"+model.getDescription()+"</html>");
		lblDescriptionValeur.setFont(fontValeur);
		lbldateAjoutValeur = new JLabel(model.getDateAjout());
		lbldateAjoutValeur.setFont(fontValeur);
		
		scroll = new JScrollPane();
		scroll.setViewportView(lblDescriptionValeur);
		scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
		scroll.setBorder(null);
		
		placerComposants();
	}
	

	protected abstract void placerComposants();
	
	

	
}
